<template>
	<div class="meun">
		<ul>
			<router-link :to="{name:item.href}" v-for="item of meun" tag="li" :key="item.id">
				<a>{{item.name}}</a>
			</router-link>

			<hr>

			<p>vueBus测试</p>
			<p>{{newCount2}}</p>
			<button @click="vueBus">vueBus测试</button>

		</ul>

	</div>
	
</template>


<script>

export default {
	name: 'Menu',
	props: {
		counter: Number,
		message: String
	},
	data() {
		return {
			newCount: this.counter,
			newCount2: 2,
			newMessage: this.message,
			childName: '子组件的shuju',
			bus: 40,
			meun: [
				{id:'001',name:'我的',href:'Detail'},
				{id:'002',name:'首页',href:'Index'},
				{id:'003',name:'详情页',href:'Detail'},
				{id:'004',name:'购物车',href:'Detail'}
			]
		}
	},
	mounted() {
		// console.log(this.$store.state.testName)
	},
	created() {
		this.$bus.emit('crBus',this.childName)
	},
	methods: {
		vueBus() {
			this.newCount2 ++
			this.$bus.emit('add',this.newCount2)

		},
		add() {
			this.newCount2 ++;
			this.$emit('addVal',this.newCount2);
		},
		increment() {
			this.$store.commit('increment')
		}
	}
}
	
</script>


<style lang="less">
	
</style>